package com.ninth_group.vo;


import java.sql.ResultSet;
import java.sql.SQLException;

public class ProvinceCitiesVO {
    private String city; // 城市名称
    private String weather; // 天气 晴/阴...
    private int temp;
    private int weatherCode;

    public static ProvinceCitiesVO mapRow(ResultSet rs) throws SQLException {
        ProvinceCitiesVO provinceCitiesVO = new ProvinceCitiesVO();
        provinceCitiesVO.setCity(rs.getString("city"));
        provinceCitiesVO.setWeather(rs.getString("weather"));
        provinceCitiesVO.setTemp(Integer.parseInt(rs.getString("temp_max")));
        return provinceCitiesVO;
    }

    public ProvinceCitiesVO() {
    }

    public ProvinceCitiesVO(String city, String weather, int temp, int weatherCode) {
        this.city = city;
        this.weather = weather;
        this.temp = temp;
        this.weatherCode = weatherCode;
    }

    @Override
    public String toString() {
        return "ProvinceCitiesVO{" +
                "city='" + city + '\'' +
                ", weather='" + weather + '\'' +
                ", temp=" + temp +
                ", weatherCode=" + weatherCode +
                '}';
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getWeather() {
        return weather;
    }

    public void setWeather(String weather) {
        this.weather = weather;
    }

    public int getTemp() {
        return temp;
    }

    public void setTemp(int temp) {
        this.temp = temp;
    }

    public int getWeatherCode() {
        return weatherCode;
    }

    public void setWeatherCode(int weatherCode) {
        this.weatherCode = weatherCode;
    }
}
